﻿// <copyright file="PagedListViewModel.cs" company="Ucaya">
// </copyright>
// <author>Ucaya</author>

namespace Channel9Kinect
{
    #region

    using System;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;

    #endregion

    public class PagedListViewModel : ViewModelBase
    {
        #region Constants and Fields

        private Uri defaultImage;

        private Uri feedUri;

        private ICommand itemCommand;

        #endregion

        #region Public Properties

        public Uri DefaultImage
        {
            get
            {
                return this.defaultImage;
            }
            set
            {
                if (this.defaultImage != value)
                {
                    this.defaultImage = value;
                    this.RaisePropertyChanged(n => n.DefaultImage);
                    this.RaisePropertyChanged(n => n.DefaultImageSource);
                }
            }
        }

        public ImageSource DefaultImageSource
        {
            get
            {
                return new BitmapImage(this.DefaultImage);
            }
        }

        public FeedItemCollectionSource FeedItemCollectionSource
        {
            get
            {
                if (this.FeedUri == null)
                {
                    return null;
                }

                return new FeedItemCollectionSource { FeedUri = this.FeedUri };
            }
        }

        public Uri FeedUri
        {
            get
            {
                return this.feedUri;
            }
            set
            {
                if (this.feedUri != value)
                {
                    this.feedUri = value;
                    this.RaisePropertyChanged(n => n.FeedUri);
                    this.RaisePropertyChanged(n => n.FeedItemCollectionSource);
                }
            }
        }

        public ICommand ItemCommand
        {
            get
            {
                return this.itemCommand;
            }
            set
            {
                if (this.itemCommand != value)
                {
                    this.itemCommand = value;
                    this.RaisePropertyChanged(n => n.ItemCommand);
                }
            }
        }

        #endregion
    }
}